package com.konsung.network;


/**
 * Created by xiangshicheng on 2017/6/29 0029.
 * 接口地址
 */

public class URLManage {

    public static final String HTTP = "http://";

    public static final String QUERYHEALTHFILE = "/imms-web/queryData/healthfile";
    public static final String CONFIG = "/imms-web/appClient/queryConfig";


    //测量数据上传接口
    public String villagehealthport;

    //远程心电申请接口
    public String requestEcgDiagnose;

    //远程心电查询接口
    public String queryEcgDiagnoses;

    //下载居民列表接口
    public String downloadPatientList;

    //下载头像接口
    public String downloadPatientHead;

    private static URLManage instance = null;
    //健康档案查询接口
    public String healthfileport = "http://192.168.0.1:9030/imms-web/queryData/healthfile";

    //配置接口
    public String configPort = "http://192.168.0.1:9030/imms-web/appClient/queryConfig";

    private String downloadHeadPicEnd = "/appDownloadPortraits"; //下载头像的url识别字符串 后缀
    private String downloadPatientEnd = "/queryPersonForApp"; //下载居民列表 后缀

    /**
     *获取单例对象
     * @return 单例对象
     */
    public static URLManage getInstance() {
        if (instance == null) {
            instance = new URLManage();
        }
        return instance;
    }

    /**
     * 动态设置地址
     * @param ipStr ip地址
     * @param portStr 端口
     * @param exit 后缀
     */
    public void setVillagehealthport(String ipStr, String portStr, String exit) {
        villagehealthport = HTTP + ipStr + ":" + portStr + exit;
    }

    /**
     * @param ipStr a
     * @param portStr a
     */
    public void setHealthFilePort(String ipStr, String portStr) {
        healthfileport = HTTP + ipStr + ":" + portStr + QUERYHEALTHFILE;
    }

    /**
     * @param ipStr a
     * @param portStr a
     */
    public void setConfigPort(String ipStr, String portStr) {
        configPort = HTTP + ipStr + ":" + portStr + CONFIG;
    }
    /**
     * 动态设置地址
     * @param ipStr ip地址
     * @param portStr 端口
     */
    public void setRequestEcgDiagnose(String ipStr, String portStr) {
        requestEcgDiagnose = HTTP + ipStr + ":" + portStr
                + "/imms-web/appRemoteEcg/requestEcgDiagnose";
    }

    /**
     * 动态设置地址
     * @param ipStr ip地址
     * @param portStr 端口
     */
    public void setQueryEcgDiagnoses(String ipStr, String portStr) {
        queryEcgDiagnoses = HTTP + ipStr + ":" + portStr
                + "/imms-web/appRemoteEcg/queryEcgDiagnoses";
    }

    /**
     * 动态设置地址-下载用户数据
     * @param ipStr ip地址
     * @param portStr 端口
     */
    public void setDownloadPatientUrl(String ipStr, String portStr) {
        downloadPatientList = HTTP + ipStr + ":" + portStr
                + "/imms-web/appClient" + downloadPatientEnd;
    }

    /**
     * 动态设置地址-下载用户头像
     * @param ipStr ip地址
     * @param portStr 端口
     */
    public void setDownloadHeadUrl(String ipStr, String portStr) {
        downloadPatientHead = HTTP + ipStr + ":" + portStr
                + "/imms-web/appClient" + downloadHeadPicEnd;
    }
}
